import { ApiProperty } from '@nestjs/swagger';
import {
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
  Length,
} from 'class-validator';

export class UpdateUserDto {
  @IsNotEmpty()
  @IsNumber()
  @ApiProperty({ description: '修改用户的id' })
  id: number;

  @IsString()
  @IsOptional()
  @ApiProperty({
    description: '主ID',
    required: true,
  })
  primary_id: string;

  @IsString()
  @IsOptional()
  @ApiProperty({
    description: '用户名',
    required: true,
  })
  name: string;

  @IsString()
  @IsOptional()
  @ApiProperty({ description: '用户密码', required: true })
  password: string;

  @IsString()
  @IsOptional()
  cover: string;

  @IsString()
  @IsOptional()
  sex: string;

  @IsString()
  @IsOptional()
  @ApiProperty({
    description: '省份',
    required: true,
  })
  province: string;

  @IsString()
  @IsOptional()
  @ApiProperty({
    required: true,
    description: '城市',
  })
  city: string;

  @IsNumber()
  @IsOptional()
  age: number;

  @IsOptional()
  @ApiProperty({
    description: '昵称',
  })
  nickname: string;

  @IsOptional()
  @ApiProperty({
    description: '用户的角色',
  })
  role: string;

  @IsOptional()
  @IsString()
  @ApiProperty({
    required: true,
    description: '手机号',
  })
  @Length(11)
  phone: string;

  @IsString()
  @IsOptional()
  description: string;

  @IsNumber()
  @IsOptional()
  @ApiProperty({
    description: '当用户需要充值的时候，或则消费了，修改该字段中的值',
  })
  account: number;
}
